package app.framework.security.util;

import jasmine.framework.common.util.NewUtil;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import java.util.List;

/**
 * @author mh.z
 */
public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper {
    private List<Cookie> cookies;

    public CustomHttpServletResponseWrapper(HttpServletResponse response) {
        super(response);
        this.cookies = NewUtil.list();
    }

    @Override
    public void addCookie(Cookie cookie) {
        super.addCookie(cookie);

        this.cookies.add(cookie);
    }

    public List<Cookie> getCookies() {
        return cookies;
    }

}
